package com.hl.sfzy.controller;


import com.hl.sfzy.dto.TeacherInfoDTO;
import com.hl.sfzy.service.TeacherInfoService;
import com.hl.sfzy.service.course.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;


@RestController
@RequestMapping("/api/teacher")
public class TeacherInfoController {
    @Autowired
    private TeacherInfoService teacherInfoService;

    @GetMapping("/info")
    public ResponseEntity<Map<String, Object>> getTeacherInfo(@RequestParam Long courseId) {
        TeacherInfoDTO teacherInfo = teacherInfoService.getTeacherInfoByCourseId(courseId);

        Map<String, Object> response = new HashMap<>();
        response.put("teacherInfo", teacherInfo);
        return ResponseEntity.ok(response);
    }
}